
@echo off
chcp 65001 >nul
REM Stop and remove existing container
echo Stopping existing container...
docker stop simpledaohang 2>nul
docker rm simpledaohang 2>nul

REM Remove old images (optional)
echo Cleaning old images...
docker rmi liured88/simpledaohang 2>nul

REM Build new image
echo Building new image...
docker build -t liured88/simpledaohang .

REM Start container with mynet network
echo Starting container with mynet network...
docker run -d ^
  --name simpledaohang ^
  --network mynet ^
  -p 7586:7531 ^
  -v "%cd%\uploads:/app/uploads" ^
  -e DB_HOST=mysql ^
  -e DB_PORT=3306 ^
  -e DB_NAME=navigation_db ^
  -e DB_USER=myadmin ^
  -e DB_PASSWORD=LSAx@2843493 ^
  -e APP_PORT=7531 ^
  -e APP_HOST=0.0.0.0 ^
  liured88/simpledaohang

REM Wait for container to start
echo Waiting for container to start...
timeout /t 10 /nobreak >nul

REM Show container status
echo Container status:
docker ps | findstr simpledaohang

REM Show recent logs
echo Recent logs:
docker logs --tail=10 simpledaohang

echo Operation completed!
echo Application will run at http://localhost:7586
echo Check logs with: docker logs -f simpledaohang
pause
